<?php

namespace App\Http\Controllers\YApi;

//use Illuminate\Http\Request;
use Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

use Session;
use Redirect;

use App\Models\UsersReg;
use App\Models\Book;
use App\Models\BooksComments; // 短书评
use App\Models\BooksReview; // 长书评

class ShupingController extends Controller
{

    public function saveduanshuping()
    {
        // 保存短书评内容
        $shuping = new BooksComments;
        $shuping->book_id = request::input('bookid');
        $shuping->uid = request::input('uid');
        $shuping->message = request::input('shuping');
        $shuping->rating = request::input('rating');
        $shuping->device = request::input('device'); // 硬件设备
        $shuping->add_time = time();
        $shuping->save();

        return 1; // 成功返回
    }

    public function saveduhougan()
    {
        // 保存长书评内容
        $duhougan = new BooksReview;
        $duhougan->book_id = request::input('bookid');
        $duhougan->uid = request::input('uid');
        $duhougan->title = request::input('title');
        $duhougan->bookreview = request::input('duhougan');
        $duhougan->rating = request::input('rating');
        $duhougan->device = request::input('device'); // 硬件设备
        $duhougan->add_time = time();
        $duhougan->save();

        return 1; // 成功返回
    }
    
}